www.gusucode.com > 网域标准通用企业自助建站系统正式版 2009 > 网域标准通用企业自助建站系统正式版 2009.18/网域公司企业网站管理系统ACCESS和SQL正式版/网域公司企业网站管理系统ACCESS正式版/EnUserCheckReg.asp

    <!--#include file="Inc/conn.asp"-->
<!--#include file="Inc/function.asp"-->
<%
dim UserName,FoundErr,ErrMsg
UserName=trim(request("UserName"))
if UserName="" or strLength(UserName)>14 or strLength(UserName)<4 then
	founderr=true
	errmsg=errmsg & "<br><li>Please Input username (between 4 and 14 characters)</li>"
else
  	if Instr(UserName,"=")>0 or Instr(UserName,"%")>0 or Instr(UserName,chr(32))>0 or Instr(UserName,"?")>0 or Instr(UserName,"&")>0 or Instr(UserName,";")>0 or Instr(UserName,",")>0 or Instr(UserName,"'")>0 or Instr(UserName,",")>0 or Instr(UserName,chr(34))>0 or Instr(UserName,chr(9))>0 or Instr(UserName,"")>0 or Instr(UserName,"$")>0 then
		errmsg=errmsg+"<br><li>Invalid characters was used in the username</li>"
		founderr=true
	end if
end if
if founderr=false then
	dim sqlCheckReg,rsCheckReg
	sqlCheckReg="select * from [User] where UserName='" & Username & "'"
	set rsCheckReg=server.createobject("adodb.recordset")
	rsCheckReg.open sqlCheckReg,conn,1,1
	if not(rsCheckReg.bof and rsCheckReg.eof) then
		founderr=true
		errmsg=errmsg & "<br><li>“" & UserName & "”Username existed, please try another name!</li>"
	else
	end if
	rsCheckReg.close
	set rsCheckReg=nothing
end if		
%>
<html>
<head>
<title>Checking username</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body>
<br>
<%
if founderr=false then
	call Success()
else
	call WriteErrmsg()
end if
%>
</body>
</html>
<%
call CloseConn

sub WriteErrMsg()
    response.write "<table align='center' width='300' border='0' cellpadding='2' cellspacing='0' class='border'>"
    response.write "<tr class='title'><td align='center' height='15'>Error hint</td></tr>"
    response.write "<tr class='tdbg'><td align='left' height='100'>" & errmsg & "<p align='center'>[<a href='javascript:onclick=window.close()'>Close</a>]<br></p></td></tr>"
	response.write "</table>" 
end sub

sub Success()
    response.write "<table align='center' width='300' border='0' cellpadding='2' cellspacing='0' class='border'>"
    response.write "<tr class='title'><td align='center' height='15'>Congratulations!</td></tr>"
    response.write "<tr class='tdbg'><td align='left' height='100'><br>“" & UserName & "”Please registered now, the name has not been used!<p align='center'>【<a href='javascript:onclick=window.close()'>Close</a>】<br></p></td></tr>"
	response.write "</table>" 
end sub
%>